<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link type="text/css" rel="stylesheet" href="/public/static/H-ui/static/h-ui/css/H-ui.min.css"/>
    <link type="text/css" rel="stylesheet" href="/public/static/system/system.css">
    <title>Document</title>
    <style>
        body{ 
            padding: 50px;
        }
        .tabBarmore{
            font-size: 20px;
        }
    </style>
</head>
<body>
    <div id="tab_demo" class="HuiTab">
        <div class="tabBar clearfix tabBarmore" id="{$Ustatus}">
            <span>我教的课</span>
            <span>我学的课</span>
        </div>
        <div class="tabCon">
            <div class="main">
                {volist name='teacourse' id='teacourse' empty='$hint'}
                <div class="course {$teacourse.isdelete=='1'?'':'none'}">
                    <div class="bg"><img src=""></div>
                    <div class="maskWraper">
                        <div class="maskBar text-c">
                            <button class="btn btn-danger radius re">恢复课程</button>
                        </div>
                        <div class="c">{$teacourse.courseName}</div>
                        <div id="modal-demo" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                            <div class="modal-dialog">
                                <div class="modal-content radius">
                                    <div class="modal-header">
                                        <h3 class="modal-title">删除</h3>
                                        <a class="close" data-dismiss="modal" aria-hidden="true" href="javascript:void();">×</a>
                                    </div>
                                    <div class="modal-body">
                                        <p>你确定要恢复{$teacourse.courseName}吗?</p>
                                    </div>
                                    <div class="modal-footer">
                                        <button class="btn btn-primary yes" data-courseid="{$teacourse.C_Id}" data-userstatus="{$teacourse.userstatus}">确定</button>
                                        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                {/volist}
            </div>
        </div>
        <div class="tabCon">
            <div class="main">
                {volist name='stucourse' id='stucourse' empty='$hint'}
                <div class="course {$stucourse.isdelete=='1'?'':'none'}">
                    <div class="bg"><img src=""></div>
                    <div class="maskWraper">
                        <div class="maskBar text-c">
                            <button class="btn btn-danger radius re">恢复课程</button>
                        </div>
                        <div class="c">{$stucourse.courseName}</div>
                        <div id="modal-demo" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                            <div class="modal-dialog">
                                <div class="modal-content radius">
                                    <div class="modal-header">
                                        <h3 class="modal-title">删除</h3>
                                        <a class="close" data-dismiss="modal" aria-hidden="true" href="javascript:void();">×</a>
                                    </div>
                                    <div class="modal-body">
                                        <p>你确定要恢复{$stucourse.courseName}吗?</p>
                                    </div>
                                    <div class="modal-footer">
                                        <button class="btn btn-primary yes" data-courseid="{$stucourse.C_Id}" data-userstatus="{$stucourse.userstatus}">确定</button>
                                        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                {/volist}
            </div>
        </div>
    </div>
    <script type="text/javascript" src="/public/static/H-ui/lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="/public/static/H-ui/static/h-ui/js/H-ui.js"></script>
    <script>
        $(function(){
            $.Huihover('.maskWraper');
            let Ustatus=$('.tabBar').attr('id');
            if(Ustatus==0){
                $.Huitab("#tab_demo .tabBar span","#tab_demo .tabCon","current","click","1")
            }else{
                $.Huitab("#tab_demo .tabBar span","#tab_demo .tabCon","current","click","0")
            }
        });

        $(".re").click(function(){
            $(this).parent().parent().find(".modal").modal("show")
        })
        $(".yes").click(function(){
            let courseId = $(this).data('courseid');
            let userstatus = $(this).data('userstatus');
            $.post(
                "{:url('recourse')}",//走到哪里去
                {
                    "courseId":courseId,
                    "userstatus":userstatus,
                },
                function(res){   //回调函数
                    if(res.flag == 1){
                        window.location.reload()
                    }else{
                        alert('恢复失败!')
                    }
                },"json"
            );
        })   
    </script>
</body>
</html>